﻿@using LyyCMS.Web.Startup
@using Abp.Authorization.Users
@using LyyCMS.Web.Models.Articles
@model CreateArticleViewModel

@{ ViewBag.Title = L("Article");
    ViewBag.CurrentPageName = PageNames.Article; }
@section scripts
    {
    <environment names="Development">
        <script src="~/view-resources/Views/Article/Create.js" asp-append-version="true"></script>
        <link href="~/libs/icheck-bootstrap/icheck-bootstrap.css" rel="stylesheet" asp-append-version="true" />
    </environment>

    <environment names="Staging,Production">
        <script src="~/view-resources/Views/Article/Create.min.js" asp-append-version="true"></script>
        <link href="~/libs/icheck-bootstrap/icheck-bootstrap.min.css" rel="stylesheet" asp-append-version="true" />
    </environment>
    
    <script src="~/ueditor-1.4.3.3/ueditor.config.js"></script>
    <script src="~/ueditor-1.4.3.3/ueditor.all.js"></script>
    <script src="~/ueditor-1.4.3.3/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        $(function () {
            var editor = UE.getEditor('container', {
                initialFrameHeight: 500
            });
            console.log(editor);
        });


    </script>
}

<section class="content-header">
    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-6">
                <h1>@L("Article")</h1>
            </div>
            <div class="col-sm-6">
                <a asp-action="Index" asp-controller="Article" class="btn bg-blue float-sm-right">
                    <i class="fa fa-plus-square"></i>
                    @L("ArticleList")
                </a>
            </div>
        </div>
    </div>
</section>
<section class="content">
    <form name="ArticleCreateForm" id="ArticleCreateForm" role="form" class="form-horizontal" enctype="multipart/form-data">
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <input type="hidden" name="Id" value="0" />
        <div class="modal-body">

            <div class="tab-content mt-4">
                <div role="tabpanel" class="tab-pane container active" id="edit-user-details">
                    <div class="form-group row required">
                        <label class="col-md-3 col-form-label">@L("ArticleCategory")</label>
                        <div class="col-md-9">
                            <select id="articleCategoryId" name="articleCategoryId" asp-for="articleCategoryId" asp-items="Model.Categories" class="form-control"></select>
                        </div>
                    </div>
                    @*<div class="form-group row required">
                        <label class="col-md-3 col-form-label" asp-for="Article.title">@L("Title")</label>
                        <div class="col-md-9">
                            <input id="Title" type="text" class="form-control" name="Title" value="@Model.Article.title" required maxlength="@AbpUserBase.MaxUserNameLength" minlength="2">
                        </div>
                    </div>*@
                    <div class="form-group row required">
                        <label class="col-md-3 col-form-label" asp-for="title">@L("Title")</label>
                        <div class="col-md-9">
                            <input asp-for="title" type="text" class="form-control" required maxlength="@AbpUserBase.MaxUserNameLength" minlength="2">
                            
                        </div>
                    </div>
                    <div class="form-group row required">
                        <label class="col-md-3 col-form-label" for="name">@L("Source")</label>
                        <div class="col-md-9">
                            <input id="Source" type="text" class="form-control" name="Source" value="@Model.source" required maxlength="@AbpUserBase.MaxNameLength">
                        </div>
                    </div>
                    <div class="form-group row required">
                        <label class="col-md-3 col-form-label">@L("Content")</label>
                        <div class="col-md-9">

                            <script id="container" name="Content" type="text/plain" style="width:100%;height:200px;">
                                @Html.Raw(Model.content)
                            </script>
                        </div>
                    </div>

                    <div class="form-group row required icheck-primary">
                        <label class="col-md-3 col-form-label">@L("Top")</label>
                        <div class="col-md-9">
                            <input id="top" type="checkbox" name="top" value="true" @(Model.top ? "checked" : "") />
                        </div>
                    </div>

                    <div class="form-group row required icheck-primary">
                        <label class="col-md-3 col-form-label">@L("Red")</label>
                        <div class="col-md-9">
                            <input id="red" type="checkbox" name="red" value="true" @(Model.red ? "checked" : "") />
                        </div>
                    </div>

                    <div class="form-group row required icheck-primary">
                        <label class="col-md-3 col-form-label">@L("Comment")</label>
                        <input id="comment1" type="checkbox" name="comment1" value="true" @(Model.comment ? "checked" : "") />
                        <div class="col-md-9  icheck-primary">
                            <input id="comment" type="checkbox" name="comment" value="true" @(Model.comment ? "checked" : "") />
                        </div>
                    </div>

                    <div class="form-group row required">
                        <label class="col-md-3 col-form-label">@L("Favorite")</label>
                        <div class="col-md-9">
                            <input id="favorite" type="number" name="favorite" value="@Model.favorite" />
                        </div>
                    </div>
                    <!--upload-->
                    <div class="form-group row">
                        <label class="col-md-3 col-form-label">@L("Thumbnail")</label>
                        <div class="col-md-9">
                            <input type="hidden" name="Thumbnail" id="Thumbnail" value="" />
                            <img width="50" height="50" id="ThumbnailShow" name="ThumbnailShow" class="img-thumbnail" />
                            <input type="file" class="form-control" name="ThumbnailFile" id="ThumbnailFile" />
                        </div>
                    </div>

                </div>
            </div>
            <div class="modal-footer justify-content-between">
                <button type="button" class="btn btn-default close-button">@L("Cancel")</button>
                <button type="button" class="btn btn-primary save-button">@L("Save")</button>
            </div>
        </div>
    </form>
</section>
